def calculate_taxi_fare(distance):
    if distance <= 3:
        return 10.0
    elif distance <= 15:
        return 10.0 + (distance - 3) * 2.1
    else:
        return 10.0 + 12 * 2.1 + (distance - 15) * 3.15

if __name__ == "__main__":
    try:
        distance = float(input("请输入行驶公里数: "))
        fare = calculate_taxi_fare(distance)
        print(f"行驶 {distance} 公里的费用为: {fare:.2f} 元")
    except ValueError:
        print("请输入有效的数字！")